

import 'package:huajianshe_app/network/response/BaseResp.dart';
import 'package:huajianshe_app/pages/main/model/MomentModel.dart';
import 'package:huajianshe_app/pages/user_info/model/UserModel.dart';
import 'package:json_annotation/json_annotation.dart';

import 'CircleHomeResp.dart';

part 'CircleModel.g.dart';

@JsonSerializable()
class CircleInfo {

  @JsonKey(name: 'blog_id')
  int? blogId;

  @JsonKey(name: 'circle_id')
  int? circleId;

  @JsonKey(name: 'circle_title')
  String? title;

  @JsonKey(name: 'recommend_status')
  int? recommendStatus;

  @JsonKey(name: 'is_circle_master')
  int? isCaptain;

  @JsonKey(name: 'is_join')
  int? isJoin;

  CircleInfo();


  factory CircleInfo.fromJson(Map<String, dynamic> json) => _$CircleInfoFromJson(json);
}

@JsonSerializable()
class MyCirclesResp extends BaseResp { // 我加入和创建的圈子

  MyCirclesData? data;

  MyCirclesResp();

  factory MyCirclesResp.fromJson(Map<String, dynamic> json) => _$MyCirclesRespFromJson(json);

  @override
  MyCirclesResp parseFromMap(Map<String, dynamic> map) {
    return MyCirclesResp.fromJson(map);
  }
}

@JsonSerializable()
class MyCirclesData  {

  @JsonKey(name: 'join_list')
  List<SimpleCircleInfo>? joined;

  @JsonKey(name: 'create_list')
  List<SimpleCircleInfo>? created;

  MyCirclesData();

  factory MyCirclesData.fromJson(Map<String, dynamic> json) => _$MyCirclesDataFromJson(json);
}

@JsonSerializable()
class SimpleCircleInfo {
  int? id;
  String? title;
  SimpleCircleInfo();
  factory SimpleCircleInfo.fromJson(Map<String, dynamic> json) => _$SimpleCircleInfoFromJson(json);
}

@JsonSerializable()
class CircleListResp extends BaseResp {
  CircleListPager? data;
  CircleListResp();

  factory CircleListResp.fromJson(Map<String, dynamic> json) => _$CircleListRespFromJson(json);

  @override
  CircleListResp parseFromMap(Map<String, dynamic> map) {
    return CircleListResp.fromJson(map);
  }
}

@JsonSerializable()
class CircleListPager extends Pager {
  List<CircleListData>? data;

  CircleListPager();

  factory CircleListPager.fromJson(Map<String, dynamic> json) => _$CircleListPagerFromJson(json);

}

@JsonSerializable()
class CircleListData {
  int? id;
  String? title;
  @JsonKey(name: 'cover_url')
  String? cover;
  @JsonKey(name: 'member_number') // 圈内人数
  int? memberNum;
  @JsonKey(name: 'view_member_num')
  int? viewNum;
  @JsonKey(name: 'label_list')
  List<CircleLabel>? labels;
  CircleListData();

  factory CircleListData.fromJson(Map<String, dynamic> json) => _$CircleListDataFromJson(json);
}

@JsonSerializable()
class CircleLabel {
  int? id;
  String? name;
  double? score;
  CircleLabel();

  factory CircleLabel.fromJson(Map<String, dynamic> json) => _$CircleLabelFromJson(json);
}

@JsonSerializable()
class CircleDetailResp extends BaseResp {
  CircleDetailData? data;
  CircleDetailResp();

  factory CircleDetailResp.fromJson(Map<String, dynamic> json) => _$CircleDetailRespFromJson(json);

  @override
  CircleDetailResp parseFromMap(Map<String, dynamic> map) {
    return CircleDetailResp.fromJson(map);
  }
}

@JsonSerializable()
class CircleDetailData {
  int? id;
  String? title;
  @JsonKey(name: 'create_time_exp')
  String? createTime;
  String? desc;
  @JsonKey(name: 'cover_url')
  String? cover;
  @JsonKey(name: 'background_urls')
  String? background;
  @JsonKey(name: 'is_circle_master')
  int? isCaptain;
  @JsonKey(name: 'is_join')
  int? isJoin;
  @JsonKey(name: 'is_score') //是否打过分
  int? isScore;
  @JsonKey(name: 'price_type') // 1付费圈子2免费圈子
  int? priceType;
  @JsonKey(name: 'price')
  String? price;
  @JsonKey(name: "blog_dynamic_number")
  int? momentNum;
  @JsonKey(name: "blog_business_opportunity_number")
  int? businessNum;
  @JsonKey(name: "member_number")
  int? memberNum;
  @JsonKey(name: 'recommend_blog_number')
  int? publicNum;
  @JsonKey(name: 'all_blog_number')
  int? privateNum;
  @JsonKey(name: 'label_list')
  List<CircleLabel>? labelScore;
  @JsonKey(name: 'label_total_score')
  double? totalScore;
  @JsonKey(name: 'view_num')
  int? viewNum;
  @JsonKey(name: 'import_circle_member_url')
  String? importUrl;
  @JsonKey(name: 'circle_member_list')
  List<CircleMember>? circleMembers;
  @JsonKey(name: 'circle_master_wechat')
  String? masterWechat;
  @JsonKey(name: 'hx_group_id')
  String? hxGroupId;

  CircleDetailData();

  factory CircleDetailData.fromJson(Map<String, dynamic> json) => _$CircleDetailDataFromJson(json);

}

@JsonSerializable()
class CircleMemberListResp extends BaseResp {
  CircleMemberListData? data;
  CircleMemberListResp();

  factory CircleMemberListResp.fromJson(Map<String, dynamic> json) => _$CircleMemberListRespFromJson(json);

  @override
  CircleMemberListResp parseFromMap(Map<String, dynamic> map) {
    return CircleMemberListResp.fromJson(map);
  }
}

@JsonSerializable()
class CircleMemberListData extends Pager {
  List<CircleMember2>? data;

  CircleMemberListData();

  factory CircleMemberListData.fromJson(Map<String, dynamic> json) => _$CircleMemberListDataFromJson(json);
}

@JsonSerializable()
class CircleMember2 {
  @JsonKey(name: 'member_info_box')
  UserInfo? userInfo;

  CircleMember2();

  factory CircleMember2.fromJson(Map<String, dynamic> json) => _$CircleMember2FromJson(json);
}

@JsonSerializable()
class CircleCreateInfo {
  int? id;
  @JsonKey(name: 'cover_id')
  int? coverId;
  @JsonKey(name: 'cover_url')
  String? cover;
  @JsonKey(name: 'background_urls')
  String? background;
  @JsonKey(name: 'background_ids')
  String? bgId;
  String? title;
  String? desc;
  @JsonKey(name: 'label_ids')
  String? labels;
  String? price;
  @JsonKey(name: 'platform_ratio')
  double? platform;
  @JsonKey(name: 'inviter_ratio')
  double? inviter;

  CircleCreateInfo();

  Map<String, dynamic> toJson() => _$CircleCreateInfoToJson(this);

  factory CircleCreateInfo.fromJson(Map<String, dynamic> json) => _$CircleCreateInfoFromJson(json);
}

@JsonSerializable()
class CircleEditResp extends BaseResp {
  CircleCreateInfo? data;
  CircleEditResp();

  factory CircleEditResp.fromJson(Map<String, dynamic> json) => _$CircleEditRespFromJson(json);

  @override
  CircleEditResp parseFromMap(Map<String, dynamic> map) {
    return CircleEditResp.fromJson(map);
  }
}


